import java.util.stream.IntStream;

public class demo8 {
    public static void main(String[] args) {
        // 并行计算1到1000万的和
        long sum = IntStream.rangeClosed(1, 100)
                .parallel() // 转为并行流
                .sum();
        System.out.println(sum);
    }
}
